<?php

class My_Work_Grid_Template_Table extends ZFWork_Grid_Template_Table {

	public function pagination($pagination, $numberRecords, $perPage, $pageSelect) {
		//$this->result['pagination'] = func_get_args();

		if (preg_match_all('#<a href="(.*?)">(.*?)</a>|<strong>(.*?)</strong>#', $pagination, $matchesarray)) {
			$pagination2 = '';
			foreach($matchesarray[3] as $key=>$value) {
				$class = '';
				$text = '';
				$href = '#';

				if($value != '') {
					$class = 'active';
					$text = $value;
				}
				else {
					$href = $matchesarray[1][$key];
					$text = $matchesarray[2][$key];
				}

				$pagination2 .= '<li class="' . $class . '"><a href="' . $href . '">' . $text . '</a></li>' . "\n";
			}
			$pagination = '<ul>' . $pagination2 . '</ul>';
		}

		return '<tfoot><tr class="pagination"><td colspan="' . $this->options['colspan'] . '">' . $pagination . '</td></tr></tfoot>';
	}

}